# -*- coding: utf-8 -*-
# created by Src - 一路好时光


import openpyxl
from openpyxl.reader.excel import load_workbook
from openpyxl.styles import Alignment, Font, colors, Side,Border

myfont = Font(name="宋体", size=20,italic=True,bold=True,color=colors.BLUE)

wb = load_workbook("python_study.xlsx")
sheet = wb["python"]
#文件不要打开处于修改状态，否则修改不了会报错
sheet["A2"].font = myfont
sheet["A2"].alignment = Alignment(horizontal='center', vertical='center')

# 第2⾏⾏⾼
sheet.row_dimensions[2].height = 40
# C列列宽
sheet.column_dimensions['C'].width = 30
border = Border(
    left=Side(border_style='medium', color=colors.BLACK),
    right=Side(border_style='medium', color=colors.BLUE),
    top=Side(border_style='medium', color=colors.BLACK),
    bottom=Side(border_style='medium', color=colors.BLACK),
    diagonal=Side(border_style='medium', color=colors.BLACK),
    diagonal_direction=0,
    outline=Side(border_style='medium', color=colors.BLACK),
    vertical=Side(border_style='medium', color=colors.BLACK),
    horizontal=Side(border_style='medium', color=colors.BLACK),
)
sheet["A2"].border = border

wb.save("python_study.xlsx")
